/**
 * 
 */
package fr.rcp.file.explorer.views;

import java.io.File;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

import fr.rcp.file.explorer.controleur.Controleur;
import fr.rcp.file.explorer.provider.FileFilter;
import fr.rcp.file.explorer.provider.TreeContentProvider;
import fr.rcp.file.explorer.provider.TreeLabelProvider;

/**
 * @author fred
 * 
 */
public class Navigation extends ViewPart {
	public static final String ID = "fr.rcp.file.explorer.views.navigation";
	private TreeViewer treeViewer;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
	 * .Composite)
	 */
	@Override
	public void createPartControl(Composite parent) {
		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
				| SWT.V_SCROLL | SWT.BORDER);
		treeViewer.setContentProvider(new TreeContentProvider());
		treeViewer.setLabelProvider(new TreeLabelProvider());
		treeViewer.setInput(new File("C:\\"));
		treeViewer.addFilter(new FileFilter());
		Controleur.getIntance().setTreeViewer(treeViewer);
		treeViewer.addSelectionChangedListener(Controleur.getIntance());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
	 */
	@Override
	public void setFocus() {
		treeViewer.getControl().setFocus();
	}

}
